//namespace ContosoUniversity.DAL
//{
//    using System;
//    using System.Linq;
//    using Models;
//    using ContosoUniversity.ViewModels;
//    using NRepository.Core.Query;

//    public class CreateEnrollmentDateGroupQueryStrategy : QueryStrategy
//    {
//        public CreateEnrollmentDateGroupQueryStrategy(IQueryRepository repository)
//        {
//            Repository = repository;
//        }

//        public IQueryRepository Repository
//        {
//            get;
//        }

//        public override IQueryable<T> GetQueryableEntities<T>(object additionalQueryData)
//        {
//            if (typeof(T).IsAssignableFrom(typeof(EnrollmentDateGroup)))
//                throw new ApplicationException($"Cannot work with {typeof(T)} typed with this query strategy");

//            var retVal = from student in Repository.GetEntities<Student>()
//                         group student by student.EnrollmentDate into dateGroup
//                         select new EnrollmentDateGroup()
//                         {
//                             EnrollmentDate = dateGroup.Key,
//                             StudentCount = dateGroup.Count()
//                         };

//            return (IQueryable<T>)retVal;
//        }
//    }
//}
